#ifndef XRECIVER_HPP
#define XRECIVER_HPP
#include "xsignal/signal.hpp"
#include <mutex>

//信号接收者
class XReciver:public SIG::sigReciver{
public:
	~XReciver(){
		
	}
	void slot1(int t1){
		std::unique_lock lock(XReciver::s_mutex);	
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot1(int t1): "<<t1 <<" "<<m_val++<<std::endl;
	}

	void slot1(int t1,int t2){
		std::unique_lock lock(XReciver::s_mutex);	
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot1(int t1,int t2): "<<t1 <<" "<<t2<<" "<<m_val++<<std::endl;
	}

	void slot6(int t1){
		std::unique_lock lock(XReciver::s_mutex);
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot6(int t1): "<<t1<<std::endl;
	}

	void slot_direct(int t1){
		std::unique_lock lock(XReciver::s_mutex);
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot_direct(int t1): "<<t1<<std::endl;
	}

	void slot2(int t1,int t2){
		std::unique_lock lock(XReciver::s_mutex);
		std::cout<<"slot2 enter!"<<std::endl;
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot2(int t1,int t2): "<<t1 <<" "<<m_val++<<" "<<t2<<std::endl;
		std::this_thread::sleep_for(std::chrono::seconds(2));
		std::cout<<"slot2 leave!"<<std::endl;
	}

	void slot3(int t1,int t2,int t3){
		std::unique_lock lock(XReciver::s_mutex);
		std::cout<<"thrdID:"<<std::this_thread::get_id()<<" void slot3(int t1,int t2,int t3): "<<t1 <<" "<<t2 <<" "<<t3<<std::endl;
	}
public:
	inline static std::mutex s_mutex;
	int m_val = 10;	
};

inline XReciver s_mutex;
#endif